
import axios from 'axios'
import React, { Component } from 'react'

export default class DoYin extends Component {
    state = {
        data: []
    }
    render () {
        return (
            <div className="container">
                <h2>抖音列表</h2>
                <hr />
                <div className="img-list">
                    {

                        this.state.data.map((item, index) => {
                            return <div key={index} className="item">
                                <div className="img">
                                    <img width="100%" src={"http://127.0.0.1:3002" + item.author_img_local} alt="" />
                                </div>
                                <div className="title">
                                    {item.desc.slice(0, 10)}
                                </div>
                                <div className="up">
                                    {item.nickname}
                                </div>
                                <div className="feather">
                                    <span>{item.tags.slice(0, 10)}</span>
                                </div>
                            </div>
                        })




                    }
                </div>

            </div>
        )
    }
    async componentDidMount () {
        let result = await axios.get('http://127.0.0.1:3002/douyin');
        console.log(result);
        this.setState({
            data: result.data
        })
    }
}
